﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;

namespace Nova_Common
{
    public class ShowBox
    {

        
        /// <summary> 
        /// 自定义弹出窗口内容 
        /// </summary> 
        /// <param ></param> 

        public static void MessageBox(Page thisPage, string msg)
        {
            //thisPage.ClientScript.RegisterStartupScript(thisPage.GetType(), "xx", "<script>alert('" + msg + "');</script>");

            thisPage.ClientScript.RegisterStartupScript(thisPage.GetType(), "", "<script>alert('" + msg + "');</script>");
        }

        /// <summary> 
        /// 自定义弹出窗口内容并转向一个新的页面 
        /// </summary> 
        /// <param >自定义消息</param> 
        /// <param >需要转到的新页面</param> 

        public static void MessageBox(Page thisPage, string msg, string Url)
        {
            thisPage.ClientScript.RegisterStartupScript(thisPage.GetType(), "xx", "<script>alert('" + msg + "');javascript:location='" + Url + "';</script>");
        }

        /// <summary> 
        /// 自定义弹出窗口内容，自定义是否关闭当前页面 
        /// </summary> 
        /// <param ></param> 
        /// <param ></param> 
        public static void MessageBox(Page thisPage, string msg, bool close)
        {
            if (close)
            {
                thisPage.ClientScript.RegisterStartupScript(thisPage.GetType(), "xx", "<script>alert('" + msg + "');javascript:window.close();</script>");
            }
            else
            {
                MessageBox(thisPage, msg);
            }
        }
    }
}

